landingAccessExtendedSelected={};function deleteAccessRow(e){landingAccessSelected[BX.data(BX(e),"id")]=false;BX.remove(BX.findParent(BX(e),{tag:"tr"},true))}function deleteAccessRowExtended(e){var n=BX.data(BX(e),"code");if(typeof landingAccessExtendedSelected[n]!=="undefined"){var t=BX.data(BX(e),"id");landingAccessExtendedSelected[n][t]=false}BX.remove(BX.findParent(BX(e),{tag:"div"},true))}(function(){"use strict";BX.namespace("BX.Landing");BX.Landing.Access=function(e){var n=landingAccessSelected;var t="rights";var d=BX("landing-"+t+"-table");var i=e.select;var a=e.inc;BX.Access.Init({other:{disabled_cr:true}});BX.Access.SetSelected(n,t);function l(){BX.Access.ShowForm({callback:function(e){for(var l in e){if(e.hasOwnProperty(l)){for(var s in e[l]){if(e[l].hasOwnProperty(s)){var c=d.rows.length;var r=d.insertRow(c-1);n[s]=true;r.insertCell(-1);r.insertCell(-1);r.insertCell(-1);r.insertCell(-1);r.cells[0].classList.add("table-blue-td-name");r.cells[1].classList.add("table-blue-td-param");r.cells[2].classList.add("table-blue-td-select");r.cells[3].classList.add("table-blue-td-action");r.cells[0].innerHTML=BX.Access.GetProviderName(l);r.cells[1].textContent=e[l][s].name;r.cells[2].innerHTML='<input type="hidden" name="'+t+'[ACCESS_CODE][]" value="'+s+'">'+i.replace("#inc#",a++);r.cells[3].innerHTML='<span onclick="deleteAccessRow(this);" data-id="'+s+'" class="table-blue-delete table-blue-delete-landing-role bitrix24-metrika" data-metrika24="permission_delete"></span>'}}}}},bind:t})}BX("landing-rights-form").addEventListener("click",l.bind(this));var s=BX.findChild(BX("landing-roles"),{class:"landing-role-delete"},true,true);s.forEach(function(e){BX(e).addEventListener("click",function(){BX.remove(BX.findParent(BX(this),{tag:"tr"},true))})});BX.bind(BX("landing-mode-form-submit"),"click",function(){BX("landing-mode-form").submit()})};BX.Landing.AccessExtended=function(e){function n(e,n){var t="rights";BX.Access.bInit=false;BX.Access.Init({other:{disabled_cr:true}});if(typeof landingAccessExtendedSelected[e]==="undefined"){landingAccessExtendedSelected[e]=n}else{for(var d in n){if(typeof landingAccessExtendedSelected[e][d]==="undefined"){landingAccessExtendedSelected[e][d]=n[d]}}}BX.Access.SetSelected(landingAccessExtendedSelected[e],t);BX.Access.ShowForm({callback:function(n){for(var d in n){if(n.hasOwnProperty(d)){for(var i in n[d]){if(n[d].hasOwnProperty(i)){landingAccessExtendedSelected[e][i]=true;var a="";var l=BX.Access.GetProviderName(d);a='<div class="landing-role-users">';a+='<input type="hidden" name="'+t+"["+e+'][]" value="'+i+'">';a+=l!==""?l+": ":"";a+=n[d][i].name;a+='<span onclick="deleteAccessRowExtended(this);" data-code="'+e+'" data-id="'+i+'" class="table-blue-delete table-blue-delete-landing-role bitrix24-metrika" data-metrika24="permission_delete"></span>';a+="</div>";BX("landing-additional-rights-fields-"+e).innerHTML+=a}}}}},bind:t})}var t=BX.findChild(BX("landing-additional-rights-table"),{class:"landing-additional-rights-form"},true,true);t.forEach(function(e){BX(e).addEventListener("click",function(){var t={};var d=BX.data(BX(e),"codes").split(",");for(var i=0,a=d.length;i<a;i++){t[d[i]]=true}n(BX.data(BX(e),"id"),t)}.bind(this))})}})();
//# sourceMappingURL=script.map.js